//    Copyright (C) Kherty.  All rights reserved.
using System;

namespace OpenLS.Spreadsheet.AnalysisToolPak
{
    internal class Actual360Basis : ConstantDateBasis
    {
        protected override int DaysInYearImp
        {
            get { return 360; }
        }

        protected override DateBasisType Type
        {
            get { return DateBasisType.Actual360; }
        }

        internal override int DaysBetweenImp(DateTime start, DateTime end)
        {
            return
       ((int)(end - new DateTime(1900, 1, 1)).TotalDays -
        (int)(start - new DateTime(1900, 1, 1)).TotalDays);

        }


        protected override int DayDifferenceImp(DateTime d1, DateTime d2)
        {
            int i1 = (d1 - new DateTime(1900, 1, 1)).Days;
            int i2 = (d2 - new DateTime(1900, 1, 1)).Days;
            return i1 - i2;
        }

        protected virtual int DaysBetweenImpOld(DateTime start, DateTime end)
        {
            return (end - start).Days;
        }
    }
}